<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fm" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>修改商品信息</title>
    <style type="text/css">
        @import url(../css/form.css);

        li {
            list-style: none;
        }

        .tdOne {
            text-align: right;
        }

        #biaoGe {
            width: 80%;
            margin: 0 auto;
            margin-top: 50px;
        }

        textarea.kuang {
            height: 300px;
            width: 600px;
        }
    </style>
    <script type="text/javascript">
        function load() {
            document.bookForm.action = "${basePath}book/toAddBook";
            document.bookForm.submit();
        }
    </script>

</head>
<body>
<%--显示错误信息--%>
<c:if test="${errors!=null}">
    <c:forEach items="${errors}" var="error">
        <font color="red">${error.defaultMessage}</font><br>
    </c:forEach>
</c:if>


<form name="bookForm" action="${pageContext.request.contextPath}/product/editSubmit.action"
      method="post" enctype="multipart/form-data">
    <input type="hidden" name="id" value="${productAndUser.id}">

    <table id="biaoGe">
        <tr>
            <td class="tdOne">商品名:</td>
            <td><input class="kuang" type="text" name="name"
                       value="${productAndUser.name}"/></td>
        </tr>

        <tr>
            <td class="tdOne">价格:</td>
            <td><input class="kuang" type="text" name="price"
                       value="${productAndUser.price}"/></td>
        </tr>

        <tr>
            <td class="tdOne">创建日期:</td>
            <td><input class="kuang" type="text" name="createtime"
                       value="<fm:formatDate value="${productAndUser.createtime}" pattern="yyyy-MM-dd HH:mm:ss"/> "/></td>
        </tr>

        <tr>
            <td class="tdOne">商品图片:</td>
            <td>
                <c:if test="${productAndUser.pic != null}">
                    <img src="/images/${productAndUser.pic}" width="100" height="100"/>
                    <br>
                </c:if>
                <input type="file" name="product_pic"/>
            </td>
        </tr>
            <td colspan="2" align="center"><input class="btn" type="submit"
                                                  value="保存" name="commit"/></td>
        <%--</tr>--%>
    </table>
</form>
</body>
</html>
